/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Model;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;

/**
 *
 * @author Duc Nhan
 */
public class StaffFactory {
    public static int salary = 100;
    private static String generateRandomName() {
        ArrayList<String> names = new ArrayList<String>();
        try {
            Scanner sc = new Scanner(new File("src\\model\\names.txt"));
            while (sc.hasNext()) {
                names.add(sc.next());
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        Random ran = new Random();
        String name = names.get(ran.nextInt(500));
        return name;
    }
    public static Staff createStaff(String staffType) {
        Staff staff = null;
        
        if (staffType.equals("Zoo Keeper")) {
            staff = new ZooKeeper(generateRandomName(), salary);
        }
        if (staffType.equals("Security Guard")) {
            staff = new SecurityGuard(generateRandomName(), salary);
        }
        if (staffType.equals("Scientist")) {
            staff = new Scientist(generateRandomName(), salary);
        }
        return staff;
    }
}
